import gr from '@/utils/guard'

export default [
  {
    path: '/users',
    component: () => import('@/views/user/index.vue'),
    meta: { title: '用户' }
  }, {
    path: '/users/:id/',
    component: () => import('@/views/user/profile/layout.vue'),
    children: [
      {
        path: '',
        redirect: to => `/users/${to.params.id}/overview`
      }, {
        path: 'overview',
        component: () => import('@/views/user/profile/overview.vue'),
        meta: { title: '' }
      }, {
        path: 'answers',
        component: () => import('@/views/user/profile/answers.vue'),
        meta: { title: '' }
      }, {
        path: 'questions',
        component: () => import('@/views/user/profile/questions.vue'),
        meta: { title: '' }
      }, {
        path: 'bookmarks',
        component: () => import('@/views/user/profile/bookmarks.vue'),
        meta: { title: '' }
      }, {
        path: 'reputation',
        component: () => import('@/views/user/profile/reputation.vue'),
        meta: { title: '' }
      }, {
        path: 'comments',
        component: () => import('@/views/user/profile/comments.vue'),
        meta: { title: '' }
      }, {
        path: 'votes',
        component: () => import('@/views/user/profile/votes.vue'),
        meta: { title: '' }
      }]
  }, {
    path: '/users/settings/',
    component: () => import('@/views/user/settings/layout.vue'),
    meta: { guard: () => gr.isLogged('/login') },
    children: [{
      path: '',
      redirect: '/users/settings/profile'
    }, {
      path: 'profile',
      component: () => import('@/views/user/settings/profile.vue'),
      meta: { title: '个人资料' }
    }, {
      path: 'notify',
      component: () => import('@/views/user/settings/notify.vue'),
      meta: { title: '通知' }
    }, {
      path: 'account',
      component: () => import('@/views/user/settings/account.vue'),
      meta: { title: '账户' }
    }
    ]
  }
]